﻿using System;

namespace Com.Fubei.OpenApi.Sdk.Exceptions
{
    public class BizException : FubeiSdkException
    {
        public BizException(int errCode, string errMsg) : base(ExceptionType.Biz)
        {
            this.ErrCode = errCode.ToString();
            this.ErrMsg = errMsg;
        }

        public BizException(int errCode, string subCode, string errMsg, object obj) : base(ExceptionType.Biz)
        {
            this.ErrCode = errCode.ToString();
            this.ErrMsg = errMsg;
        }

        public BizException(string errCode, string errMsg) : base(ExceptionType.Biz)
        {
            this.ErrCode = errCode;
            this.ErrMsg = errMsg;
        }

        public string ErrCode { get; private set; }

        public string ErrMsg { get; private set; }

        public override string ToString()
        {
            return string.Format("[{0}] 错误:\"{1}\"", ErrCode, ErrMsg);
        }

        public override string Message
        {
            get { return ToString(); }
        } 
    }
}
